/*
 * @Author: lixiaowei
 * @Date: 2021-04-10 17:12:46
 * @LastEditors: lixiaowei
 * @LastEditTime: 2021-04-10 17:21:35
 * @Description: file content
 * @FilePath: /heima-bli/STL/序列查找.cpp
 */

#include <iostream>
#include <vector>

using namespace std;

int main()
{
  int arr[] = {0, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 9};
  int len = sizeof(arr) / sizeof(arr[0]);

  cout << count(arr, arr + len, 7) << endl;
  cout << count_if(arr, arr + len, bind2nd(less<int>(), 7)) << endl;
  cout << binary_search(arr, arr + len, 7) << endl; // 二分查找

  vector<int> iA(arr + 2, arr + 6);

  cout << *search(arr, arr + len, iA.begin(), iA.end()) << endl;

  return 0;
}